//
//  Human.m
//  解归档
//
//  Created by apple on 15/9/6.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "Human.h"

@implementation Human

- (void)setBook:(Book *)book
{
    _book = [book copy];
}

//归档
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.book forKey:@"book"];
    [aCoder encodeInt:self.age forKey:@"age"];
}

//解归档；
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super init])
    {
        self.book = [aDecoder decodeObjectForKey:@"book"];
        self.age = [aDecoder decodeIntForKey:@"age"];
    }
    return self;
}

@end
